import request from '@/utils/request';
import { FillActFrom, FillManagementForm } from '@/api/fill/management/Types';
import { FillDTO } from '@/api/fill/business/Types';
import { AxiosPromise } from 'axios';
import { OssVO } from '@/api/system/oss/types';

/**
 * 列表显示全部
 * @param data
 */
export const getListManageAll = (data?: FillDTO) => {
  return request({
    url: '/fillManageTwo/getListAll',
    method: 'post',
    data: data
  });
};

/**
 * 下达数据列表
 * @param data
 */
export const getListIssueAll = (data?: FillDTO) => {
  return request({
    url: '/fillManageTwo/getListIssueAll',
    method: 'post',
    data: data
  });
};

/**
 * 添加列表显示
 * @param data
 */
export const getListManage = (data: any) => {
  return request({
    url: '/fillManageTwo/getList',
    method: 'post',
    data: data
  });
};

//保存或编辑
export const saveOrUpdateNew = (data?: FillManagementForm) => {
  return request({
    url: '/fillManageTwo/saveOrUpdateNew',
    method: 'post',
    data: data
  });
};

/**
 * 提交
 * @param data
 */
export const submitAll = (data?: FillActFrom) => {
  return request({
    url: '/fillManageTwo/submitAll',
    method: 'post',
    data: data
  });
};

/**
 * 上传文件
 * @param data
 */
export const uploadFile = (data?: any) => {
  return request({
    url: '/fillManageTwo/uploadFile',
    method: 'post',
    data: data
  });
};

/**
 * 查看文件
 * @param id
 */
export const getFile = (id: any): AxiosPromise<OssVO> => {
  return request({
    url: '/fillManageTwo/getFile/' + id,
    method: 'get',
    params: id
  });
};

/**
 * 删除文件
 * @param ossId
 */
export const deleteFile = (ossId?: any) => {
  return request({
    url: '/fillManageTwo/deleteFile/' + ossId,
    method: 'get',
    params: ossId
  });
};

/**
 * 查询归口统计的申请列表
 * @param query
 */
export const getApplyList = (query?: any) => {
  return request({
    url: '/fillManageTwo/getApplyList',
    method: 'post',
    data: query
  });
};

/**
 * 查询详情
 * @param id
 */
export const getFillActManageDetail = (id?: any) => {
  return request({
    url: '/fillManageTwo/getById/+' + id,
    method: 'get',
    params: id
  });
};

/**
 * 校验是否提交
 * @param data
 */
export const verify = (data?: FillDTO) => {
  return request({
    url: '/fillManageTwo/verify',
    method: 'post',
    data: data
  });
};
